<template>
  <div class="container">
  <h1>我的</h1>
    <form class="form-signin">
      <h1 class="h3 mb-3 font-weight-normal" align="center">请登录</h1>
      <label for="username" class="sr-only">用户名</label>
      <input type="text" id="username" class="form-control" placeholder="用户名" required="" autofocus="" v-model="loginForm.username">
      <label for="inputPassword" class="sr-only">密码</label>
      <input type="password" id="inputPassword" class="form-control" placeholder="密码" required="" v-model="loginForm.password">
      <!-- <div class="checkbox mb-3">
        <label>
          <input type="checkbox" value="remember-me">记住我
        </label>
      </div> -->
      <button class="btn btn-lg btn-success btn-block" @click="login">登录</button>
      <button class="btn btn-lg btn-primary btn-block" @click="register">注册</button>
      <h5 class="mt-5 mb-3 text-muted" align="center">© 2019-NOW</h5>
    </form>
  </div>
</template>

<script>
export default {
    name: "My",
    data () {
        return {
            msg: 'Hello AdminEntry',
            loginForm: {
              username: '',
              password: ''
            }
        }
    },
    methods: {
      login () {
        if (this.loginForm.username === 'admin' && this.loginForm.password === 'admin') {
          this.$router.push({path: '/AdminHome'})
        }
      },

      register () {
        this.$router.push({path: '/AdminRegister'})
      },

      initForm () {
      this.loginForm.username = ''
      this.loginForm.password = ''
    }

    }
}
</script>

<style>
.form-signin {
  width: 100%;
  max-width: 330px;
  padding: 15px;
  margin: auto;
}
.form-signin .checkbox {
  font-weight: 400;
}
.form-signin .form-control {
  position: relative;
  box-sizing: border-box;
  height: auto;
  padding: 10px;
  font-size: 16px;
}
.form-signin .form-control:focus {
  z-index: 2;
}
.form-signin input[type="email"] {
  margin-bottom: -1px;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
  margin-bottom: 10px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
</style>